package com.zenithsun.common.dao;

import java.sql.Connection;
import java.util.List;

import org.hibernate.SQLQuery;

import com.syzg.base.merge.model.Person;
import com.syzg.common.dao.BaseDAO;

/**
 * 拓展一部分原生态SQL的DAO实现
 * @author wanglei@enersun.com.cn
 */
public interface NativeSQLDao<T> extends BaseDAO<T>{

	/**
	 * 查询内容
	 * @param query
	 * @return List<T>
	 * @throws Exception
	 */
	public List<T> queryBySQL(SQLQuery query) throws Exception;
	
	/**
	 * 查询数量
	 * @param query {@link SQLQuery}
	 * @return int
	 * @throws Exception
	 */
	public int getCountBySQL(SQLQuery query) throws Exception;
	
	/**
	 * 获取JDBC连接
	 * @return
	 * @throws Exception
	 */
	public Connection getConnection() throws Exception;
	
	/**
	 * 通过登录名获取登录用户的信息
	 * @param persionId
	 * @return Person
	 * @throws Exception
	 */
	public Person getPersonByPersionId(String persionId) throws Exception;
}
